﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Luminal;

namespace Luminoise
{
    public class Constant : Module
    {
        static int instanceCount = 0;
        int instanceIndex;

        public float Value { get; set;}

        public override string FunctionName
        {
            get { return "cl_constant" + instanceIndex.ToString(); }
        }

        public override string GetCode()
        {
            return 
@"#ifndef " + FunctionName.ToUpper() + @"
#define " + FunctionName.ToUpper() + @"

float " + FunctionName + @"(__global int *perm, Single3 input)
{
    return " + Value.ToString() + @";
}

#endif

";
        }

        public Constant(float value)
        {
            Value = value;

            instanceIndex = instanceCount;
            instanceCount++;
        }
    }
}
